<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="format-detection" content="telephone=no">
    <meta name="viewport" content="minimal-ui,width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <title>欢乐畅购</title>
    <link href="__PUBLIC__/wap/css/rest.css"  rel="stylesheet">
    <link href="__PUBLIC__/wap/css/user.css"  rel="stylesheet">
     <link href="__PUBLIC__/wap/css/product.css"  rel="stylesheet">
    <link href="__PUBLIC__/wap/css/product_details.css" rel="stylesheet" type="text/css">
</head>
<body id="bg_color">
<!--绑定头部-->

<div class="p_content">
    <div class="c_display">
        <div class="header">
            <p>Commodity display</p>
            <hr>
            <span>商品展示</span>
        </div>

      <div id="pLayout">
        <div class="new-wt">
            <div class="miblebox">
                <div class="slider">
                    <ul>
                        <li><a href="javascript:void(0);" target="_blank"><img id="img_url" src="{$goods.goods_img}" alt=""></a></li>
                          
                            <volist name="goods['img_url']" id="vo">
                                 <li><a href="javascript:void(0);" target="_blank"><img id="img_url" src="{$vo.img_url}" alt=""></a></li>
                            </volist>
                    </ul>
                </div>
                <div class="pd_product-title-wrap">
                    <div class="pd_product-title-box">
                        <h2 class="pd_product-title" id="pd_product-title" title="">{$goods.goods_name}</h2>
                        <!-- <h3 class="pd_product-subtitle" id="pd_product-subtitle" title="">{$goods.goods_brief}</h3> -->
                        <div class="pd_product-price" id="current_price">
                            <span class="pd_product-price-yen">¥</span>
                            <strong class="pd_product-price-num ">{$goods.shop_price}</strong>
                        </div>
                    </div>
                  
                </div>
        
            </div>
            <div class="miblebox">
                <dl class="list-entry"  style="position: relative;">
                  <dt class="row01">
                        <span class="col01" >剩余数量：</span>
                        <span class="col02 now_ch" id="goods_num" goods_num="{$goods['goods_num']}">
                             <if condition="$goods['goods_num'] eq 0">
                                <b>领完啦!</b>
                                <else/>
                                <b>{$goods.goods_num}件</b>
                            </if>
                        </span>
                    </dt>
                  
                </dl>
     

                <dl class="list-entry">
                    <dt class="row01 unite-font-size">
                        <a href="＃" id="wareInfo">
                            <span class="col01">商品简介</span>
                        </a>
                    </dt>
                   
                    <div class="detail">
                        {$goods.goods_brief}
                    </div>
                </dl>
            </div>
        </div>
    </div>

      
       
    </div>
    <div class="information">
        <if condition="$goods['goods_num'] gt 0 && empty($is_get)">
        <div class="header">
            <p>Information filling</p>
            <hr>
            <span>信息填写</span>
        </div>
        <div class="register">
            <form action="" role="form" id="binding_form" novalidate="novalidate" method="post"
                  onSubmit="return false;">
                <input type="hidden" name="article_id" value="{$_GET['article_id']}" />
            <div class="user_log">
                <if condition="empty($bind_mobile)">
                    <p>注册信息</p>
                    <div class="user">
                        <img src="__PUBLIC__/wap/img/logo_03.png"/>
                        <input class="text_box text_border" type="tel" name="binding_mobile" id="binding_mobile"
                               placeholder="请输入手机号码" maxlength="11">
                    </div>
                    <div class="yzm">
                        <input class="text_message text_border" type="text" name="binding_mobile_code"
                               id="binding_mobile_code" placeholder="请输入验证码" maxlength="6">
                        <!--<input type="submit" value="获取验证码"/>-->
                        <a href="javascript:;" class="again_message  binding_send_sms">
                            <button class="text binding_get_sms" value="button">获取验证码</button>
                            <span class="binding_countdown" style="display:none;">（<em
                                    class="binding_num">60</em>S）</span>
                        </a>
                    </div>
                    <div class="user ">
                        <img src="__PUBLIC__/wap/img/logo_07.png"/>
                        <input class="text_pwd text_border" type="password" name="binding_mem_password"
                               id="binding_mem_password" placeholder="请输入密码" maxlength="20">
                    </div>
                    <div class="user ">
                        <img src="__PUBLIC__/wap/img/logo_07.png"/>
                        <input class="text_pwd text_border" type="password" name="binding_rep_password"
                               id="binding_rep_password" placeholder="请确认密码" maxlength="20">
                    </div>
                </if>
            </div>
                <p>地址</p>
            <if condition="empty($address)">
                <div class="user_log">
                    <div class="user ">
                        <img src="__PUBLIC__/wap/img/logo_10.png"/>
                        <input type="text" name="consignee" placeholder="收货人"/>
                    </div>
                    <notempty name="bind_mobile">
                    <div class="user ">
                        <img src="__PUBLIC__/wap/img/logo_03.png"/>
                        <input type="text" name="mobile" placeholder="手机"/>
                    </div>
                    </notempty>
                    <div class="user ">
                        <img src="__PUBLIC__/wap/img/logo_10.png"/>
                        <input type="text" name="address" placeholder="填写地址"/>
                    </div>
                </div>
                <else/>
                <div class="user_log">
                    <div class="user ">
                        <img src="__PUBLIC__/wap/img/logo_10.png"/>
                        <input type="text" name="consignee" placeholder="收货人" value="{$address.consignee}"/>
                    </div>
                    <div class="user ">
                        <img src="__PUBLIC__/wap/img/logo_03.png"/>
                        <input type="text" name="mobile" placeholder="手机" value="{$address.mobile}"/>
                    </div>
                    <div class="user ">
                        <img src="__PUBLIC__/wap/img/logo_10.png"/>
                        <input type="text" name="address" placeholder="填写地址"
                               value="{$address.address_name}&nbsp;{$address.address}" style="width: 70%"/>
                    </div>
                </div>
            </if>
             <a href="javascript:void(0);" class="new-abtn-type new-mg-tb30 phone_binding_btn"
              style="width: 100px;margin: 0 auto;  <if condition="empty($address)">    background-color: #ccc;</if>">提交</a> 
              
            </form>
        </div>
            <else/>
            <div style="text-align: center;">
            <img src="__PUBLIC__/wap/img/fenggoo_QR_cord" style="margin-top: 30px; max-width: 100%;">
            </div>
        </if>
    </div>
    <div class="receive">
        <div class="header">
            <p>Receive records</p>
            <hr>
            <span>领取记录</span>
        </div>
        <div class="r_list">
            <div id="items" style="float: left;    width: 100%;
    height: 360px;
    display: inline;
    font-size: 12px;
    overflow: hidden;">
                 <div id="items1" >
                      <ul class="more_html">
                <volist name="list" id="vo">
                    <li>
                        <div class="list">
                            <span><img src="{$vo.member_logo}" alt="" title=""></span>
                            <p>会员编号：{$vo.member_card} </p>
                          <!--   <p class="margin15">手机号：<b>{$vo.member_mobile}</b></p> -->
                            <p>领取时间：{$vo.date}</p>
                        </div>
                    </li>
                </volist>
            </ul>
                 </div>
                  <div id="items2"  <if condition="count($list) lt 6">style="display:none;"</if>>
                     
                  </div>
            </div>
           
            <div class="fm-footer-copyright get_more" style="float: left;    width: 100%;margin:0 auto;margin-bottom: 5px;">
               <!--  <if condition="$count gt 6 && count($list) eq 6">
                   加载更多记录
                   <else/>
                   无更多记录
               </if> -->
            </div>
        </div>
    </div>
</div>
 
     <div style="height:88px;">
   </div>
    <!--<input type="button" name="button" value="分享" onclick="activity_share();"/>-->

   <input type="hidden" name="p" data="2" value="2"/>
   <input type="hidden" name="article_id" data="" value="{$_GET.article_id}"/>
   
     <!--end top-->
  
<include file="Public/wap_javascript"/>
<script type="text/javascript">
    var binding_is_check = 0;// 重复再次弹出 1是 0否
    var binding_page ='tweet_detail';// //当前页面名称 不可重复
</script>
  <script type="text/javascript" src="__PUBLIC__/wap/js/yxMobileSlider.js"></script>
    <script>
        $(".slider").yxMobileSlider({width:630,height:640,during:3000})
    </script>
<!--绑定-->
<include file="Public/binding_phone"/>
<!--绑定-->
<!--微信分享-->
<include file="Public/share_weixin"/>
<script type="text/javascript" >
    //分享量计次
    function activity_share() {
        var type = "<?php echo $data['type']; ?>";
        if (type == 1) {
            var article_id = $('input[name="article_id"]').val();
            $.ajax({
                url: "{:U('wap/activity/set_activity_share')}",
                type: 'post',
                data: {article_id: article_id},
                dataType: 'json',
                success: function (data) {
                    //console.log(data);
                    if (data.status == '1') {
                        window.location.href = "{:U('wap/activity/index',array('article_id'=>1))}";//;
                    } else {

                    }
                }
            });
        }
    }
</script>
<script type="text/javascript">

    $('.verify_refresh').click(function () {
        //重载验证码
        var time = new Date().getTime();
        var src = '{:U('Wap/Login/verify')}?' + time;
        $(this).attr('src', src);
    });
</script>

<script>
    jQuery(document).ready(function () {

        //FormValidator.init();

        jQuery.validator.addMethod("binding_pwd_required", function (value) {
            var is_binding = $("#is_binding").val();
            var ret = true;
            if (is_binding == '0') {
                if (value) {

                } else {
                    ret = false;
                }
            }
            return ret;
        });
        jQuery.validator.addMethod("binding_pwd_rangelength", function (value) {
            var is_binding = $("#is_binding").val();
            var ret = true;
            if (is_binding == '0') {
                if (value) {
                    var leng = value.length;
                    if (leng < 6 || leng > 20) {
                        ret = false;
                    }
                } else {
                    ret = false;
                }
            }
            return ret;
        });
        jQuery.validator.addMethod("binding_rep_required", function (value) {
            var is_binding = $("#is_binding").val();
            var ret = true;
            if (is_binding == '0') {
                if (value) {

                } else {
                    ret = false;
                }
            }
            return ret;
        });
        jQuery.validator.addMethod("binding_rep_rangelength", function (value) {
            var is_binding = $("#is_binding").val();
            var ret = true;
            if (is_binding == '0') {
                if (value) {
                    var leng = value.length;
                    if (leng < 6 || leng > 20) {
                        ret = false;
                    }
                } else {
                    ret = false;
                }
            }
            return ret;
        });
        jQuery.validator.addMethod("binding_rep_equalTo", function (value) {
            var binding_mem_password = $("#binding_mem_password").val();
            var is_binding = $("#is_binding").val();
            var ret = true;
            if (is_binding == '0') {
                if (value == binding_mem_password) {

                } else {
                    ret = false;
                }
            }
            return ret;
        });


        $("#binding_form").validate({
            rules: {
                 binding_mobile: {
                    required: true,
                    number: true,
                    minlength: 11,
                    remote: {
                        url: "{:U('Wap/Login/cheack_binding_mobile')}",
                        type: "get",
                        dataType: "json",
                        data: {
                            mobile: function () {
                                return $("#binding_mobile").val();　　　　//这个是取要验证的数据
                            }
                        },
                        dataFilter: function (msg) {　　　　//判断控制器返回的内容
                            $('#is_binding').val(msg);
                            //0  未注册 1 已注册
                            if (msg == '0') {//填写密码
                                $('.binding_set_pwd').show();
                            } else {
                                $('.binding_set_pwd').hide();
                            }
                            return true;
                        }
                    }
                },
                mobile: {
                    required: true,
                    number: true,
                    minlength: 11
                },
                binding_mobile_code: {
                    required: true,
                    remote: {
                        url: "{:U('Wap/Login/check_send_reg')}",
                        type: "get",
                        dataType: "json",
                        data: {
                            mobile: function () {
                                return $("#binding_mobile").val();　　　　//这个是取要验证的数据
                            },
                            mobile_code: function () {
                                return $("#binding_mobile_code").val();　　　　//这个是取要验证的数据
                            }
                        },
                        dataFilter: function (msg) {　　　　//判断控制器返回的内容
                            if (msg == "1") {
                                return true;
                            } else {
                                return false;
                            }
                        }
                    }
                },
                binding_mem_password: {
                    required:true,
                    binding_pwd_required: true,
                    binding_pwd_rangelength: true,
                },
                binding_rep_password: {
                    required:true,
                    binding_rep_required: true,
                    binding_rep_rangelength: true,
                    binding_rep_equalTo: true
                },
                address:'required',
                consignee:'required',


            },
            messages: {
                binding_mobile: {
                    required:'<span class="icon-warning icon_warning"></span>&nbsp;请输入手机号码',
                    binding_pwd_required: '<span class="icon-warning icon_warning"></span>&nbsp;请输入手机号码',
                    number: '<span class="icon-warning icon_warning"></span>&nbsp;请输入正确的手机号码',
                    minlength: '<span class="icon-warning icon_warning"></span>&nbsp;请输入正确的手机号码',
                    remote: '<span class="icon-warning icon_warning"></span>&nbsp;手机号码已注册'
                },
                mobile: {
                    required: '<span class="icon-warning icon_warning"></span>&nbsp;请输入手机号码',
                    number: '<span class="icon-warning icon_warning"></span>&nbsp;请输入正确的手机号码',
                    minlength: '<span class="icon-warning icon_warning"></span>&nbsp;请输入正确的手机号码',
                },
                binding_mobile_code: {
                    required: '<span class="icon-warning icon_warning"></span>&nbsp;请输入手机验证码',
                    remote: '<span class="icon-warning icon_warning"></span>&nbsp;手机验证码不正确'
                },
                binding_mem_password: {
                    required: '<span class="icon-warning icon_warning"></span>&nbsp;请输入密码',
                    binding_pwd_required: '<span class="icon-warning icon_warning"></span>&nbsp;请输入密码',
                    binding_pwd_rangelength: '<span class="icon-warning icon_warning"></span>&nbsp;密码请保持6-20位'
                },
                binding_rep_password: {
                    required: '<span class="icon-warning icon_warning"></span>&nbsp;请输入重复密码',
                    binding_rep_required: '<span class="icon-warning icon_warning"></span>&nbsp;请输入重复密码',
                    binding_rep_rangelength: '<span class="icon-warning icon_warning"></span>&nbsp;确认密码请保持6-20位',
                    binding_rep_equalTo: '<span class="icon-warning icon_warning"></span>&nbsp;两次密码输入不一致'
                },
                address: '<span class="icon-warning icon_warning"></span>&nbsp;请输入收货地址',
                consignee: '<span class="icon-warning icon_warning"></span>&nbsp;请输入收货人'
            },
            focusInvalid: false,
            success: function (label) {
                // set  as text for IE 
                // alert('ok'); 
                $('.phone_binding_btn').css('background-color','#c00')
                //label.html(" ").addClass("checked"); 
            },
            /*执行ajaxsubmit  */
            submitHandler: function (editform) {

                var options = {
                    url: "<?php echo U('Wap/Activity/activity_binding'); ?>",
                    type: "post",
                    dataType: 'json',
                    target: "#loader",
                    error: function () {
                        layer.msg("服务器没有返回数据，可能服务器忙，请重试", {icon: 5});
                    },
                    onwait: "正在处理信息，请稍候...",
                    success: function (response) {
                        // console.log(response);
                        //$("#loader").fadeIn(500).html(response.data).fadeOut(500); 
                        //$('#editform').hide(2000); 
                        if (response.status == 1) {
                            //alert("注册成功");
                            layer.msg('领取成功', {icon: 6}, function () {
                                //领取成功后的操作
//                                window.location.href = "<?php echo U('Wap/Member/index'); ?>";
                                var content='<div style="text-align: center;">'+
                                                ' <img src="__PUBLIC__/wap/img/fenggoo_QR_cord" style="margin-top: 30px;max-width: 100%;">'+
                                            '</div>';
                                $('.information').html(content);  //改变信息填写

                                $("input[name='p']").attr('data',1); //改变当前页码
                                get_more();  //查询领取记录

                                var goods_num = parseInt($('#goods_num').attr('goods_num'))-1;  //获取领取后剩余数量
                                var number='';
                                if(goods_num >0){   //判断剩余数量
                                    number='<b>'+goods_num+'件</b>';
                                }else{
                                    number = '<b>领完啦!</b>';
                                }
                                $('#goods_num').html(number);
                            });
                        } else {
                            layer.msg(response.error, {icon: 5});
                            // alert(response.error);
                        }
                    }
                };
                setTimeout((function (opt) {
                    return function () {
                        $('#binding_form').ajaxSubmit(opt);
                    }
                })(options), 300);
                return false;
            }

        });


        $('.phone_binding_btn').click(function () {
            $('#binding_form').submit();
        });

        $('.binding_send_sms').click(function () {
            var is_send = $(this).hasClass('disable');
            if (is_send) {
                return false;
            } else {
                //短信发送
                $.ajax({
                    url: "{:U('Wap/Activity/binding_send_sms')}",
                    type: "get",
                    dataType: "json",
                    data: {
                        mobile: function () {
                            return $("#binding_mobile").val();　　　　//这个是取要验证的数据
                        }
                    },
                    success: function (msg) {　　　　//判断控制器返回的内容
                        if (msg.status == "1") {
                            //disable
                            // $('#mobile_code').val(msg.code);
                            // alert("验证码发送成功");
                            layer.msg('验证码发送成功', {icon: 6});
                            run_time_out();
                        } else {
                            // alert(msg.msg);
                            layer.msg(msg.msg, {icon: 5});
                        }
                    }
                });
            }
        });

    });
    function run_time_out() {
        var num = $('.binding_num').html();
        num = parseInt(num);
        var is_send = $('.binding_send_sms').hasClass('disable');
        if (num > 0) {
            $('.binding_get_sms').hide();
            $('.binding_countdown').show();
            $('.binding_send_sms').css('cssText', 'background-color: #eee;color: #666;-webkit-appearance: none;');
            num--;
            $('.binding_num').html(num);//显示倒计时
            if (!is_send) {
                $('.binding_send_sms').addClass('disable');///禁止点击
            }
        } else {
            $('.binding_countdown').hide();
            $('.binding_get_sms').show();
            $('.binding_num').html(60);//初始化倒计时
            $('.binding_send_sms').removeClass('disable');///可以点击
            $('.binding_send_sms').removeAttr('style');
            return false;
        }
        setTimeout('run_time_out()', 1000);
    }
</script>
<script type="text/javascript">
    $(function () {
        $('.binding_phone_close').click(function () {
            $('.binding_phone_head_all').hide();
        });

        $('.binding_phone_go').click(function () {
            get_binding()
        });

        $('.is_guanzhu_close').click(function () {
            $('.is_guanzhu_all').remove();
        });

    });
    $(window).scroll(function () {
        if ($(window).scrollTop() > 5) {
            $(".is_guanzhu_all").css('cssText', 'position:fixed;top:0;z-index:999;');
            ;
        }
        else {
            $(".is_guanzhu_all").css('cssText', '');
            ;
        }
    });
</script>
<script type="text/javascript">
    var load_more = 0;
    var load_none = 0;
    $(function () {
        $(window).scroll(function () {
            var scrollTop = $(this).scrollTop();
            var scrollHeight = $(document).height();
            var windowHeight = $(this).height();
            if (scrollTop + windowHeight == scrollHeight) {
                //此处是滚动条到底部时候触发的事件，在这里写要加载的数据，或者是拉动滚动条的操作
                if (load_none != 1) {
                    if (load_more == 1) {
                        var html = ' <img src="__PUBLIC__/wap/img/icon_zhuan.gif" style="max-width:15px;">'
                        $('.get_more').html('加载中' + html);
                    } else {
                        get_more();
                    }
                }
            }
        });
    });
    function get_more() {
        load_more = 1;
        var html = ' <img src="__PUBLIC__/wap/img/icon_zhuan.gif" style="max-width:15px;">'
        $('.get_more').html('加载中' + html);
        //var p=$("input[name='p']").val();
        var search = '<?php echo $_GET["search"] ?>';
        var p = $("input[name='p']").attr('data');
         var article_id = $("input[name='article_id']").val();
        
        $.ajax({
            url: "{:U('wap/Activity/index')}",
            type: 'get',
            data: {p: p,article_id:article_id},
            dataType: 'json',
            success: function (data) {
                //console.log(data);
                var con = 1;
                var option = '';
                if (data) {
                    $.each(data, function (i, value) {
                        //this指向当前元素
                        //i表示Array当前下标
                        //value表示Array当前元素
                        option +='<li>'+
                        '<div class="list">'+
                        '<span><img src="'+this.member_logo+'" alt="" title=""></span>'+
                        '<p>会员编号：'+this.member_card+' </p>'+
                       // '<p class="margin15">手机号：<b>'+this.member_mobile+'</b></p>'+
                        '<p>领取时间：'+this.date+'</p>'+
                        '</div></li>';
                        con++;
                    });
                }
                //$('.more_html').append(option);
                if (p == 1) {
                    $('.more_html').html(option);
                } else {
                    $('.more_html').append(option);
                }
                load_more = 0;
                if (option) {
                    //$("input[name='p']").val(parseInt(p)+1);
                    $("input[name='p']").attr('data', parseInt(p) + 1);
                }
                if (con < 6) {
                    load_none = 1;
                    $('.get_more').html('');
                }else{
                    $('.get_more').html('');
                }
            }
        });
    }

    var speed=98
var items2=document.getElementById("items2");
var items1=document.getElementById("items1");
var items=document.getElementById("items");
  items2.innerHTML=items1.innerHTML
  function Marquee(){
  if(items2.offsetTop-items.scrollTop<=0)
  items.scrollTop-=items1.offsetheight
  else{
  items.scrollTop++
  }
  }
  var myMar=setInterval(Marquee,speed)
 // items.onmouseover=function() {clearInterval(myMar);}
 // items.onmouseout=function() {myMar=setInterval(Marquee,speed);}
</script>

</body>
</html>